package com.defeng.system.factory;

import com.defeng.common.core.domain.R;
import com.defeng.system.remote.RemoteTaskservice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ProjectName: lxdf-cloud-6.20
 * @Package: com.defeng.system.factory
 * @ClassName: RemoteTaskFallbackFactory
 * @Author: 86158
 * @Description:
 * @Date: 2022/6/30 14:27
 * @Version: 1.0
 * 远程调用熔断
 * 谢德丰
 */
@Component
public class RemoteTaskFallbackFactory implements FallbackFactory<RemoteTaskservice> {
    private static final Logger log = LoggerFactory.getLogger(RemoteTaskFallbackFactory.class);
    @Override
    public RemoteTaskservice create(Throwable cause) {
        log.error("服务调用失败:{}", cause.getMessage());
        return new RemoteTaskservice() {
            @Override
            public R initCache() {
                return null;
            }

        };
    }
}
